<template>
	<view>
		<view class="wait">等待支付</view>
		<view class="f">{{d.username}}</view>
		<view class="f">tel:{{d.tel}}</view>
		<view class="f1">
			<navigator url="../../address/address">
			收货地址:{{list1.provinceStr}}{{list1.cityStr}}{{list1.areaStr}}
		    </navigator>
		</view>
		<view class="center">
		  <view class="center1">
			<view>订单编号</view>
			<view>等待支付</view>
		  </view>
		  <view class="center2" v-for="item in b">
			<image :src="item.cover_img"></image>
			<view class="name">{{item.gname}}</view>
			<view class="num">x{{item.num}}</view>
			<view class="price">￥{{item.skuList[0].price}}</view>
		  </view>
		  <view class="hj">合计:{{heji}}</view>
		  <view class="qr" @tap='js'>确认付款</view>
		</view>
	</view>
</template>

<script>
import {detail,add} from '../../../../util/user/user.js'
	export default {
		data() {
			return {
				b:[],
				d:'',
				list1:[],
				res1:''
			}
		},
		methods: {
			js(){
				add({
					userId:this.d.id,
					addressId:this.list1.brand_id,
					count:this.b.num,
					freight:'10',
					price:this.heji,
					'orderDetail[0].skuId':this.b[0].seriesId,
					'orderDetail[0].price':this.b[0].skuList[0].price,
					'orderDetail[0].count':this.b[0].skuList[0].count,
					'orderDetail[1].skuId':this.b[0].seriesId,
					'orderDetail[1].price':this.b[0].skuList[0].price,
					'orderDetail[1].count':this.b[0].skuList[0].count,
				})
				.then(res=>{
					console.log(res)
					uni.setStorageSync('res',res)
				
				})
				uni.navigateTo({
					url:'/pages/user/cardlist/pay/pay1'
				})
			}
		},
		computed:{
			heji(){
				var num=0
				this.b.forEach(function(item){
					num+=item.skuList[0].price * item.num					
				})
				return num
			}
		},
		onLoad(val1) {
			console.log(val1)
			detail({
				id:val1.id
			})
			.then(res=>{
				console.log(res)
				this.list1=res.data.data
			})
			
			var a=uni.getStorageSync('list')
			console.log(a)
			this.b=a
			console.log(this.b)
			this.d=uni.getStorageSync('userInfo')
			uni.setStorageSync('num',this.heji)
			
			
			
		}
	}
</script>

<style>
  .wait{
	  width: 660rpx;
	  height: 100rpx;
	  margin: 10rpx auto;
	  font-size: 40rpx;
	  line-height: 100rpx;
  }
  .f{
	  float: left;
	  margin-left: 45rpx;
	  
  }
  .f1{
	  width: 660rpx;
	  margin: 60rpx auto;
	  text-align: left;
  }
  .center{
	  width: 660rpx;
	  background-color: white;
	  margin: 80rpx auto;
  }
  .center1{
	  display: flex;
	  height: 100rpx;
	  justify-content: space-between;
	  
  }
  .center1 view{
	  width: 180rpx;
	  text-align: center; 
  }
  .center image{
	  width: 161rpx;
	  height: 161rpx;
	  margin-left: 20rpx;
  }
  .center2{
	  position: relative;
	  height: 200rpx;
  }
  .name{
	  position: absolute;
	  left: 200rpx;
	  top: 10rpx;
  }
  .price{
	  position: absolute;
	  left: 500rpx;
	  top: 10rpx;
  }
  .num{
	  position: absolute;
	  left: 530rpx;
	  top: 60rpx;
  }
  .hj{
	  margin-left: 500rpx;
  }
  .qr{
	  margin-left: 500rpx;
	  width: 150rpx;
	  height: 60rpx;
	  border:1px solid black;
	  text-align: center;
	  line-height: 60rpx;
  }
</style>
